package com.ming_za.od_updater_sdk.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * Json包装器，快速创建Map
 */
public class JsonPackageBuilder {

    private final Map<String,Object> map;

    public JsonPackageBuilder() {
        map = new HashMap<>();
    }

    public static JsonPackageBuilder create() {
        return new JsonPackageBuilder();
    }

    public JsonPackageBuilder put(String key, Object value) {
        map.put(key, value);
        return this;
    }

    public Map<String,Object> build() {
        return map;
    }

    public Map<String, String> buildString(){
        Map<String, String> rMap = new HashMap<>();
        for (String key : map.keySet()) {
            rMap.put(key, String.valueOf(map.get(key)));
        }
        return rMap;
    }
}
